<?php
class LoginForm extends CFormModel
{
    public $password;

    public function rules()
    {
        return array(
            array('password', 'required'),
        );
    }

    public function login()
    {
        $identity = new UserIdentity('nav', $this->password);
        if ($identity->authenticate()) {
            Yii::app()->user->login($identity);
            return true;
        } else {
            $this->addError('password', 'Password error');
            return false;
        }
    }
}